class CreateSchema < ActiveRecord::Migration
  def self.up
    create_table "sprints" do |t|
      t.column "name", :string    # name is our foreign key to milestone table in Trac DB.
      t.column "goal", :text
      t.column "start_date", :date
      t.column "number_of_days", :integer
      t.column "created_at", :datetime
      t.column "updated_at", :datetime
    end
    create_table "users" do |t|
      t.column "username", :string
      t.column "password", :string
      t.column "created_at", :datetime
      t.column "updated_at", :datetime
    end    
    create_table "tasks" do |t|
      t.column "ticket_id", :string
      t.column "sprint_id", :integer 
      t.column "name", :string     
      t.column "notes", :text
      t.column "user_id", :integer
      t.column "initial_estimate", :integer
      t.column "created_at", :datetime
      t.column "updated_at", :datetime      
    end
    create_table "estimates" do |t|
      t.column "task_id", :integer      
      t.column "date", :date
      t.column "hours", :integer
      t.column "created_at", :datetime
      t.column "updated_at", :datetime      
    end    
    
    
    
    admin = User.new(:username => "admin", :password => "password")
    admin.save
    
  end

  def self.down
    drop_table "estimates"
    drop_table "tasks"
    drop_table "users"
    drop_table "sprints"
    
  end
end
